<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>方式3</title>
    <style>
        .container {
            width: 400px;
            height:400px;
            background-color: skyblue;
            margin:0 auto;
            overflow: hidden;
        }

        .main {
            width:200px;
            height: 200px;
            background-color: blue;
            margin:100px auto;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="main">
            这是内容
        </div>
    </div>
</body>
</html>